home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue53 / ccorn / Listing2.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-12-09  |  441 b   |  12 lines

  1. function IsControlRunning(Control: IUnknown): Boolean;
  2. var
  3.   OleObj: IOleObject;
  4.   Site: IOleClientSite;
  5. begin
  6.   Result := True;
  7.   // Get control's IOleObject pointer.  From that, get container's
  8.   // IOleClientSite.  From that, get IAmbientDispatch.
  9.   if (Control.QueryInterface(IOleObject, OleObj) = S_OK) and
  10.     (OleObj.GetClientSite(Site) = S_OK) and (Site <> nil) then
  11.     Result := (Site as IAmbientDispatch).UserMode;
  12. end;